ToStr::to_str -> ToString::to_string
authorMichael Gehring <mg@ebfe.org>
Wed, 9 Jul 2014 13:38:10 +0000 (15:38 +0200)
committerAlex Crichton <alex@alexcrichton.com>
Thu, 10 Jul 2014 15:37:57 +0000 (08:37 -0700)
Conflicts:
src/cargo/core/resolver.rs
src/cargo/ops/cargo_rustc.rs

27 files changed:
src/bin/cargo-test.rs
src/bin/cargo-verify-project.rs
src/bin/cargo.rs
src/cargo/core/dependency.rs
src/cargo/core/errors.rs
src/cargo/core/manifest.rs
src/cargo/core/package.rs
src/cargo/core/package_id.rs
src/cargo/core/resolver.rs
src/cargo/core/shell.rs
src/cargo/core/source.rs
src/cargo/core/summary.rs
src/cargo/core/version_req.rs
src/cargo/lib.rs
src/cargo/ops/cargo_rustc.rs
src/cargo/sources/git/source.rs
src/cargo/sources/git/utils.rs
src/cargo/sources/path.rs
src/cargo/util/config.rs
src/cargo/util/dependency_queue.rs
src/cargo/util/errors.rs
src/cargo/util/process_builder.rs
src/cargo/util/toml.rs
tests/support/mod.rs
tests/test_cargo_compile.rs
tests/test_cargo_compile_path_deps.rs
tests/test_shell.rs

index 257b7024ef72a9e55ecf15e2714c75d6c811d9fa..2115612f1475e80477ea917c186ba6aa306ef180 100644 (file)
@@ -64,7 +64,7 @@ fn execute(options: Options, shell: &mut MultiShell) -> CliResult<Option<()>> {
     for file in walk {
         // TODO: The proper fix is to have target knows its expected
         // output and only run expected executables.
-        if file.display().to_str().as_slice().contains("dSYM") { continue; }
+        if file.display().to_string().as_slice().contains("dSYM") { continue; }
         if !is_executable(&file) { continue; }
 
         try!(util::process(file).exec().map_err(|e| {
index 9760ecd4f1136ddbea9faf3a086eb1218d030e70..777b4305297afd582bcb581e7a57123901015206 100644 (file)
@@ -34,7 +34,7 @@ fn main() {
         }
     };
     let file = Path::new(manifest);
-    let contents = match File::open(&file).read_to_str() {
+    let contents = match File::open(&file).read_to_string() {
         Ok(s) => s,
         Err(e) => return fail("invalid", format!("error reading file: {}",
                                                  e).as_slice())
index c3577bdd8144d96ed35476942c4ff91067f9f013..3be5ec8176097d9300b30f2b2f98c76108b8f22f 100644 (file)
@@ -81,7 +81,7 @@ fn execute() {
 
 fn process(args: Vec<String>) -> (String, Vec<String>) {
     let mut args = Vec::from_slice(args.tail());
-    let head = args.shift().unwrap_or("--help".to_str());
+    let head = args.shift().unwrap_or("--help".to_string());
 
     (head, args)
 }
@@ -156,5 +156,5 @@ fn locate_project(_: NoFlags, _: &mut MultiShell) -> CliResult<Option<ProjectLoc
                                          not representable in Unicode"))
                       .map_err(|e| CliError::from_boxed(e, 1)));
 
-    Ok(Some(ProjectLocation { root: string.to_str() }))
+    Ok(Some(ProjectLocation { root: string.to_string() }))
 }
index 2c5dd06324e3592ae8de6ad499c77a72fb11930d..9fe2e08dcd2c8e1e3aff4e91ca0597b55f5b9d6d 100644 (file)
@@ -19,7 +19,7 @@ impl Dependency {
         };
 
         Ok(Dependency {
-            name: name.to_str(),
+            name: name.to_string(),
             namespace: namespace.clone(),
             req: version,
             transitive: true
@@ -67,8 +67,8 @@ pub struct SerializedDependency {
 impl SerializedDependency {
     pub fn from_dependency(dep: &Dependency) -> SerializedDependency {
         SerializedDependency {
-            name: dep.get_name().to_str(),
-            req: dep.get_version_req().to_str()
+            name: dep.get_name().to_string(),
+            req: dep.get_version_req().to_string()
         }
     }
 }
index 03ea07809e263a2462515837566c20a282c6048b..695ecba9de63ecfdb52c77abc3eb0ef48ac26d7e 100644 (file)
@@ -32,8 +32,8 @@ pub struct CLIError {
 impl CLIError {
     pub fn new<T: Show, U: Show>(msg: T, detail: Option<U>,
                                  exit_code: uint) -> CLIError {
-        let detail = detail.map(|d| d.to_str());
-        CLIError { msg: msg.to_str(), detail: detail, exit_code: exit_code }
+        let detail = detail.map(|d| d.to_string());
+        CLIError { msg: msg.to_string(), detail: detail, exit_code: exit_code }
     }
 }
 
@@ -84,7 +84,7 @@ impl CargoError {
     }
 
     pub fn described<T: Show>(description: T) -> CargoError {
-        CargoInternalError(Described(description.to_str()))
+        CargoInternalError(Described(description.to_string()))
     }
 
     pub fn other() -> CargoError {
index 9d4da5c2a6dbd44dcb903c236d3139e7f0399416..a7ed88af178fd8e94b5c0139fb13d60dc097340f 100644 (file)
@@ -47,14 +47,14 @@ pub struct SerializedManifest {
 impl<E, S: Encoder<E>> Encodable<S, E> for Manifest {
     fn encode(&self, s: &mut S) -> Result<(), E> {
         SerializedManifest {
-            name: self.summary.get_name().to_str(),
-            version: self.summary.get_version().to_str(),
+            name: self.summary.get_name().to_string(),
+            version: self.summary.get_version().to_string(),
             dependencies: self.summary.get_dependencies().iter().map(|d| {
                 SerializedDependency::from_dependency(d)
             }).collect(),
             authors: self.authors.clone(),
             targets: self.targets.clone(),
-            target_dir: self.target_dir.display().to_str(),
+            target_dir: self.target_dir.display().to_string(),
             build: if self.build.len() == 0 { None } else { Some(self.build.clone()) },
         }.encode(s)
     }
@@ -112,7 +112,7 @@ pub struct Profile {
 impl Profile {
     pub fn default_dev() -> Profile {
         Profile {
-            env: "compile".to_str(), // run in the default environment only
+            env: "compile".to_string(), // run in the default environment only
             opt_level: 0,
             debug: true,
             test: false, // whether or not to pass --test
@@ -122,31 +122,31 @@ impl Profile {
 
     pub fn default_test() -> Profile {
         Profile {
-            env: "test".to_str(), // run in the default environment only
+            env: "test".to_string(), // run in the default environment only
             opt_level: 0,
             debug: true,
             test: true, // whether or not to pass --test
-            dest: Some("test".to_str())
+            dest: Some("test".to_string())
         }
     }
 
     pub fn default_bench() -> Profile {
         Profile {
-            env: "bench".to_str(), // run in the default environment only
+            env: "bench".to_string(), // run in the default environment only
             opt_level: 3,
             debug: false,
             test: true, // whether or not to pass --test
-            dest: Some("bench".to_str())
+            dest: Some("bench".to_string())
         }
     }
 
     pub fn default_release() -> Profile {
         Profile {
-            env: "release".to_str(), // run in the default environment only
+            env: "release".to_string(), // run in the default environment only
             opt_level: 3,
             debug: false,
             test: false, // whether or not to pass --test
-            dest: Some("release".to_str())
+            dest: Some("release".to_string())
         }
     }
 
@@ -218,7 +218,7 @@ impl<E, S: Encoder<E>> Encodable<S, E> for Target {
         SerializedTarget {
             kind: kind,
             name: self.name.clone(),
-            src_path: self.src_path.display().to_str(),
+            src_path: self.src_path.display().to_string(),
             profile: self.profile.clone(),
             metadata: self.metadata.clone()
         }.encode(s)
@@ -312,7 +312,7 @@ impl Target {
     {
         Target {
             kind: LibTarget(crate_targets),
-            name: name.to_str(),
+            name: name.to_string(),
             src_path: src_path.clone(),
             profile: profile.clone(),
             metadata: Some(metadata.clone())
@@ -322,7 +322,7 @@ impl Target {
     pub fn bin_target(name: &str, src_path: &Path, profile: &Profile) -> Target {
         Target {
             kind: BinTarget,
-            name: name.to_str(),
+            name: name.to_string(),
             src_path: src_path.clone(),
             profile: profile.clone(),
             metadata: None
index 275cc26b45e543f59ff5d08702ce64d3676cb6fa..d43fe26d835600c63a5c568790829c49be6b879a 100644 (file)
@@ -45,14 +45,14 @@ impl<E, S: Encoder<E>> Encodable<S, E> for Package {
         let package_id = summary.get_package_id();
 
         SerializedPackage {
-            name: package_id.get_name().to_str(),
-            version: package_id.get_version().to_str(),
+            name: package_id.get_name().to_string(),
+            version: package_id.get_version().to_string(),
             dependencies: summary.get_dependencies().iter().map(|d| {
                 SerializedDependency::from_dependency(d)
             }).collect(),
             authors: Vec::from_slice(manifest.get_authors()),
             targets: Vec::from_slice(manifest.get_targets()),
-            manifest_path: self.manifest_path.display().to_str()
+            manifest_path: self.manifest_path.display().to_string()
         }.encode(s)
     }
 }
@@ -123,7 +123,7 @@ impl Package {
         // Sort the sources just to make sure we have a consistent fingerprint.
         sources.sort_by(|a, b| {
             cmp::lexical_ordering(a.kind.cmp(&b.kind),
-                                  a.location.to_str().cmp(&b.location.to_str()))
+                                  a.location.to_string().cmp(&b.location.to_string()))
         });
         let sources = sources.iter().map(|source_id| {
             source_id.load(config)
index 8e31bfe920f035bc7322bc171c02dba1998ff68f..376772958a9041080fc48909a78725c21036bac5 100644 (file)
@@ -99,7 +99,7 @@ impl PackageId {
                              sid: &SourceId) -> CargoResult<PackageId> {
         let v = try!(version.to_version().map_err(InvalidVersion));
         Ok(PackageId {
-            name: name.to_str(),
+            name: name.to_string(),
             version: v,
             source_id: sid.clone()
         })
@@ -120,7 +120,7 @@ impl PackageId {
     pub fn generate_metadata(&self) -> Metadata {
         let metadata = format!("{}:-:{}:-:{}", self.name, self.version, self.source_id);
         let extra_filename = short_hash(
-            &(self.name.as_slice(), self.version.to_str(), &self.source_id));
+            &(self.name.as_slice(), self.version.to_string(), &self.source_id));
 
         Metadata { metadata: metadata, extra_filename: format!("-{}", extra_filename) }
     }
@@ -132,7 +132,7 @@ impl Show for PackageId {
     fn fmt(&self, f: &mut Formatter) -> fmt::Result {
         try!(write!(f, "{} v{}", self.name, self.version));
 
-        if self.source_id.to_str().as_slice() != central_repo {
+        if self.source_id.to_string().as_slice() != central_repo {
             try!(write!(f, " ({})", self.source_id));
         }
 
@@ -153,7 +153,7 @@ impl<D: Decoder<Box<CargoError + Send>>>
 
 impl<E, S: Encoder<E>> Encodable<S,E> for PackageId {
     fn encode(&self, e: &mut S) -> Result<(), E> {
-        (self.name.clone(), self.version.to_str(), self.source_id.clone()).encode(e)
+        (self.name.clone(), self.version.to_string(), self.source_id.clone()).encode(e)
     }
 }
 
index 6401dacb51b5615c126129c6e64a5a0209b07a66..69f03fc248c759b204e1e6f5cb57e0bd4ca8fcbd 100644 (file)
@@ -82,7 +82,7 @@ fn resolve_deps<'a, R: Registry>(parent: &PackageId,
         }
 
         let summary = pkgs.get(0).clone();
-        let name = summary.get_name().to_str();
+        let name = summary.get_name().to_string();
         let source_id = summary.get_source_id().clone();
         let version = summary.get_version().clone();
 
@@ -179,7 +179,7 @@ mod test {
 
     fn pkg_id_loc(name: &str, loc: &str) -> PackageId {
         let remote = Location::parse(loc);
-        let source_id = SourceId::new(GitKind("master".to_str()),
+        let source_id = SourceId::new(GitKind("master".to_string()),
                                       remote.unwrap());
 
         PackageId::new(name, "1.0.0", &source_id).unwrap()
@@ -197,7 +197,7 @@ mod test {
 
     fn dep_loc(name: &str, location: &str) -> Dependency {
         let url = from_str(location).unwrap();
-        let source_id = SourceId::new(GitKind("master".to_str()), Remote(url));
+        let source_id = SourceId::new(GitKind("master".to_string()), Remote(url));
         Dependency::parse(name, Some("1.0.0"), &source_id).unwrap()
     }
 
index 32ca19934c68f546e30618326743a596e1838d03..37a816102406f5684dc94422624e0c3e991c9a48 100644 (file)
@@ -42,7 +42,7 @@ impl MultiShell {
         &mut self.err
     }
 
-    pub fn say<T: ToStr>(&mut self, message: T, color: Color) -> IoResult<()> {
+    pub fn say<T: ToString>(&mut self, message: T, color: Color) -> IoResult<()> {
         self.out().say(message, color)
     }
 
@@ -60,11 +60,11 @@ impl MultiShell {
         Ok(())
     }
 
-    pub fn error<T: ToStr>(&mut self, message: T) -> IoResult<()> {
+    pub fn error<T: ToString>(&mut self, message: T) -> IoResult<()> {
         self.err().say(message, RED)
     }
 
-    pub fn warn<T: ToStr>(&mut self, message: T) -> IoResult<()> {
+    pub fn warn<T: ToString>(&mut self, message: T) -> IoResult<()> {
         self.err().say(message, YELLOW)
     }
 }
@@ -96,10 +96,10 @@ impl Shell {
         Ok(())
     }
 
-    pub fn say<T: ToStr>(&mut self, message: T, color: Color) -> IoResult<()> {
+    pub fn say<T: ToString>(&mut self, message: T, color: Color) -> IoResult<()> {
         try!(self.reset());
         if color != BLACK { try!(self.fg(color)); }
-        try!(self.write_line(message.to_str().as_slice()));
+        try!(self.write_line(message.to_string().as_slice()));
         try!(self.reset());
         try!(self.flush());
         Ok(())
index 22590a892f9d0f19cb4f08869826cab36d0d0969..6284f755ad8d2dae85471c2439f11ae21eba7100 100644 (file)
@@ -73,7 +73,7 @@ impl<E, D: Decoder<E>> Decodable<D, E> for Location {
 
 impl<E, S: Encoder<E>> Encodable<S, E> for Location {
     fn encode(&self, e: &mut S) -> Result<(), E> {
-        self.to_str().encode(e)
+        self.to_string().encode(e)
     }
 }
 
@@ -137,8 +137,8 @@ impl PartialEq for SourceId {
         match (&self.kind, &other.kind, &self.location, &other.location) {
             (&GitKind(..), &GitKind(..),
              &Remote(ref u1), &Remote(ref u2)) => {
-                git::canonicalize_url(u1.to_str().as_slice()) ==
-                    git::canonicalize_url(u2.to_str().as_slice())
+                git::canonicalize_url(u1.to_string().as_slice()) ==
+                    git::canonicalize_url(u2.to_string().as_slice())
             }
             _ => false,
         }
@@ -156,7 +156,7 @@ impl SourceId {
     }
 
     pub fn for_git(url: &Url, reference: &str) -> SourceId {
-        SourceId::new(GitKind(reference.to_str()), Remote(url.clone()))
+        SourceId::new(GitKind(reference.to_string()), Remote(url.clone()))
     }
 
     pub fn for_central() -> SourceId {
index fcad56a2f69e4c0d911ce48993ba455552817a09..59cf9e75f5c0676f5503f4d40f467d5107cb70e9 100644 (file)
@@ -48,7 +48,7 @@ pub trait SummaryVec {
 impl SummaryVec for Vec<Summary> {
     // TODO: Move to Registry
     fn names(&self) -> Vec<String> {
-        self.iter().map(|summary| summary.get_name().to_str()).collect()
+        self.iter().map(|summary| summary.get_name().to_string()).collect()
     }
 
 }
index 75a5b0df67d3a2b3a99d21892081fb8b5a6c4112..eec1510673383b2ce3048c9f9288bd15c81f8cb9 100644 (file)
@@ -487,14 +487,14 @@ mod test {
     pub fn test_parsing_exact() {
         let r = req("1.0.0");
 
-        assert!(r.to_str() == "= 1.0.0".to_str());
+        assert!(r.to_string() == "= 1.0.0".to_string());
 
         assert_match(&r, ["1.0.0"]);
         assert_not_match(&r, ["1.0.1", "0.9.9", "0.10.0", "0.1.0"]);
 
         let r = req("0.9.0");
 
-        assert!(r.to_str() == "= 0.9.0".to_str());
+        assert!(r.to_string() == "= 0.9.0".to_string());
 
         assert_match(&r, ["0.9.0"]);
         assert_not_match(&r, ["0.9.1", "1.9.0", "0.0.9"]);
@@ -504,7 +504,7 @@ mod test {
     pub fn test_parsing_greater_than() {
         let r = req(">= 1.0.0");
 
-        assert!(r.to_str() == ">= 1.0.0".to_str());
+        assert!(r.to_string() == ">= 1.0.0".to_string());
 
         assert_match(&r, ["1.0.0"]);
     }
index 259839ca30b9538fb541e35d2988c411d3d1140f..a20ea11b52869f377411d5de4c372ad9a5a2b2b8 100644 (file)
@@ -206,7 +206,7 @@ pub fn handle_error(err: CliError, shell: &mut MultiShell) {
     if unknown {
         let _ = shell.error("An unknown error occurred");
     } else {
-        let _ = shell.error(error.to_str());
+        let _ = shell.error(error.to_string());
     }
 
     if error.cause().is_some() {
@@ -248,7 +248,7 @@ fn global_flags() -> CliResult<GlobalFlags> {
 
 fn json_from_stdin<T: RepresentsJSON>() -> CliResult<T> {
     let mut reader = io::stdin();
-    let input = try!(reader.read_to_str().map_err(|_| {
+    let input = try!(reader.read_to_string().map_err(|_| {
         CliError::new("Standard in did not exist or was not UTF-8", 1)
     }));
 
index 4ce26e1c6b202f814c0ef057c4e72dae93470553..7bb33059e014589d112c14721ef68cd93948a54b 100644 (file)
@@ -80,7 +80,7 @@ pub fn compile_targets<'a>(env: &str, targets: &[&Target], pkg: &Package,
     try!(File::create(&file));
 
     let output = try!(util::process("rustc")
-                      .arg(file.display().to_str())
+                      .arg(file.display().to_string())
                       .arg("--crate-name").arg("-")
                       .arg("--crate-type").arg("dylib")
                       .arg("--print-file-name")
@@ -99,7 +99,7 @@ pub fn compile_targets<'a>(env: &str, targets: &[&Target], pkg: &Package,
         resolve: resolve,
         package_set: deps,
         config: config,
-        dylib: (parts.get(0).to_str(), parts.get(1).to_str())
+        dylib: (parts.get(0).to_string(), parts.get(1).to_string())
     };
 
     // Build up a list of pending jobs, each of which represent compiling a
@@ -196,7 +196,7 @@ fn is_fresh(dep: &Package, loc: &Path,
         Err(..) => return Ok((false, new_fingerprint)),
     };
 
-    let old_fingerprint = try!(file.read_to_str());
+    let old_fingerprint = try!(file.read_to_string());
 
     log!(5, "old fingerprint: {}", old_fingerprint);
     log!(5, "new fingerprint: {}", new_fingerprint);
@@ -247,16 +247,16 @@ fn rustc(package: &Package, target: &Target, cx: &mut Context) -> Job {
 
     log!(5, "command={}", rustc);
 
-    let _ = cx.config.shell().verbose(|shell| shell.status("Running", rustc.to_str()));
+    let _ = cx.config.shell().verbose(|shell| shell.status("Running", rustc.to_string()));
 
     proc() {
         if primary {
             log!(5, "executing primary");
-            rustc.exec().map_err(|err| human(err.to_str()))
+            rustc.exec().map_err(|err| human(err.to_string()))
         } else {
             log!(5, "executing deps");
             rustc.exec_with_output().and(Ok(())).map_err(|err| {
-                human(err.to_str())
+                human(err.to_string())
             })
         }
     }
@@ -285,61 +285,61 @@ fn build_base_args(into: &mut Args,
     let metadata = target.get_metadata();
 
     // TODO: Handle errors in converting paths into args
-    into.push(target.get_src_path().display().to_str());
+    into.push(target.get_src_path().display().to_string());
 
-    into.push("--crate-name".to_str());
-    into.push(target.get_name().to_str());
+    into.push("--crate-name".to_string());
+    into.push(target.get_name().to_string());
 
     for crate_type in crate_types.iter() {
-        into.push("--crate-type".to_str());
-        into.push(crate_type.to_str());
+        into.push("--crate-type".to_string());
+        into.push(crate_type.to_string());
     }
 
     let out = cx.dest.clone();
     let profile = target.get_profile();
 
     if profile.get_opt_level() != 0 {
-        into.push("--opt-level".to_str());
-        into.push(profile.get_opt_level().to_str());
+        into.push("--opt-level".to_string());
+        into.push(profile.get_opt_level().to_string());
     }
 
     // Right now -g is a little buggy, so we're not passing -g just yet
     // if profile.get_debug() {
-    //     into.push("-g".to_str());
+    //     into.push("-g".to_string());
     // }
 
     if profile.is_test() {
-        into.push("--test".to_str());
+        into.push("--test".to_string());
     }
 
     match metadata {
         Some(m) => {
-            into.push("-C".to_str());
+            into.push("-C".to_string());
             into.push(format!("metadata={}", m.metadata));
 
-            into.push("-C".to_str());
+            into.push("-C".to_string());
             into.push(format!("extra-filename={}", m.extra_filename));
         }
         None => {}
     }
 
     if target.is_lib() {
-        into.push("--out-dir".to_str());
-        into.push(out.display().to_str());
+        into.push("--out-dir".to_string());
+        into.push(out.display().to_string());
     } else {
-        into.push("-o".to_str());
-        into.push(out.join(target.get_name()).display().to_str());
+        into.push("-o".to_string());
+        into.push(out.join(target.get_name()).display().to_string());
     }
 }
 
 fn build_deps_args(dst: &mut Args, package: &Package, cx: &Context) {
-    dst.push("-L".to_str());
-    dst.push(cx.dest.display().to_str());
-    dst.push("-L".to_str());
-    dst.push(cx.deps_dir.display().to_str());
+    dst.push("-L".to_string());
+    dst.push(cx.dest.display().to_string());
+    dst.push("-L".to_string());
+    dst.push(cx.deps_dir.display().to_string());
 
     for target in dep_targets(package, cx).iter() {
-        dst.push("--extern".to_str());
+        dst.push("--extern".to_string());
         dst.push(format!("{}={}/{}",
                  target.get_name(),
                  cx.deps_dir.display(),
index cb8677b3d92813cb5d4cec2db752bac0148562e5..120e91eab12bb8349072cc530b4372906b3eb077 100644 (file)
@@ -65,11 +65,11 @@ fn ident(location: &Location) -> String {
     let ident = match *location {
         Local(ref path) => {
             let last = path.components().last().unwrap();
-            str::from_utf8(last).unwrap().to_str()
+            str::from_utf8(last).unwrap().to_string()
         }
         Remote(ref url) => {
             let path = canonicalize_url(url.path.path.as_slice());
-            path.as_slice().split('/').last().unwrap().to_str()
+            path.as_slice().split('/').last().unwrap().to_string()
         }
     };
 
@@ -79,7 +79,7 @@ fn ident(location: &Location) -> String {
         ident
     };
 
-    let location = canonicalize_url(location.to_str().as_slice());
+    let location = canonicalize_url(location.to_string().as_slice());
 
     format!("{}-{}", ident, to_hex(hasher.hash(&location.as_slice())))
 }
index 73d1c91372bb1c3edfdc0157bce3f16ef5d33d26..a94ab58accfd385579d05cd8185090e887481e4f 100644 (file)
@@ -19,7 +19,7 @@ impl GitReference {
         if string.as_slice() == "master" {
             Master
         } else {
-            Other(string.as_slice().to_str())
+            Other(string.as_slice().to_string())
         }
     }
 }
@@ -79,7 +79,7 @@ struct EncodableGitRemote {
 impl<E, S: Encoder<E>> Encodable<S, E> for GitRemote {
     fn encode(&self, s: &mut S) -> Result<(), E> {
         EncodableGitRemote {
-            location: self.location.to_str()
+            location: self.location.to_string()
         }.encode(s)
     }
 }
@@ -102,7 +102,7 @@ impl<E, S: Encoder<E>> Encodable<S, E> for GitDatabase {
     fn encode(&self, s: &mut S) -> Result<(), E> {
         EncodableGitDatabase {
             remote: self.remote.clone(),
-            path: self.path.display().to_str()
+            path: self.path.display().to_string()
         }.encode(s)
     }
 }
@@ -129,9 +129,9 @@ impl<E, S: Encoder<E>> Encodable<S, E> for GitCheckout {
     fn encode(&self, s: &mut S) -> Result<(), E> {
         EncodableGitCheckout {
             database: self.database.clone(),
-            location: self.location.display().to_str(),
-            reference: self.reference.to_str(),
-            revision: self.revision.to_str()
+            location: self.location.display().to_string(),
+            reference: self.reference.to_string(),
+            revision: self.revision.to_string()
         }.encode(s)
     }
 }
@@ -182,8 +182,8 @@ impl GitRemote {
 
     fn fetch_location(&self) -> String {
         match self.location {
-            Local(ref p) => p.display().to_str(),
-            Remote(ref u) => u.to_str(),
+            Local(ref p) => p.display().to_string(),
+            Remote(ref u) => u.to_string(),
         }
     }
 }
@@ -308,10 +308,10 @@ fn git_output(path: &Path, str: String) -> CargoResult<String> {
                                                      .chain_error(||
         human(format!("Executing `git {}` failed", str))));
 
-    Ok(to_str(output.output.as_slice()).as_slice().trim_right().to_str())
+    Ok(to_str(output.output.as_slice()).as_slice().trim_right().to_string())
 }
 
 fn to_str(vec: &[u8]) -> String {
-    str::from_utf8_lossy(vec).to_str()
+    str::from_utf8_lossy(vec).to_string()
 }
 
index e5a2a5757e7937c9af0894f126a593ec3c85be73..dc19769563b59dcc65a4f07c3c1c8f652831d4d6 100644 (file)
@@ -102,7 +102,7 @@ impl Source for PathSource {
             let loc = pkg.get_manifest_path().dir_path();
             max = cmp::max(max, try!(walk(&loc, true)));
         }
-        return Ok(max.to_str());
+        return Ok(max.to_string());
 
         fn walk(path: &Path, is_root: bool) -> CargoResult<u64> {
             if !path.is_dir() {
index e733f672e8520a6b8951bafcb12c6216d9f8e0d5..de48b375d9e321b76942ef604a278aebcf15e049 100644 (file)
@@ -118,7 +118,7 @@ impl<E, S: Encoder<E>> Encodable<S, E> for ConfigValue {
 impl fmt::Show for ConfigValue {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         let paths: Vec<String> = self.path.iter().map(|p| {
-            p.display().to_str()
+            p.display().to_string()
         }).collect();
         write!(f, "{} (from {})", self.value, paths)
     }
@@ -184,16 +184,16 @@ fn walk_tree(pwd: &Path,
 }
 
 fn extract_config(mut file: io::fs::File, key: &str) -> CargoResult<ConfigValue> {
-    let contents = try!(file.read_to_str());
+    let contents = try!(file.read_to_string());
     let toml = try!(cargo_toml::parse(contents.as_slice(),
                                       file.path().filename_display()
-                                          .to_str().as_slice()));
+                                          .to_string().as_slice()));
     let val = try!(toml.find_equiv(&key).require(|| internal("")));
 
     let v = match *val {
         toml::String(ref val) => String(val.clone()),
         toml::Array(ref val) => {
-            List(val.iter().map(|s: &toml::Value| s.to_str()).collect())
+            List(val.iter().map(|s: &toml::Value| s.to_string()).collect())
         }
         _ => return Err(internal(""))
     };
@@ -204,8 +204,8 @@ fn extract_config(mut file: io::fs::File, key: &str) -> CargoResult<ConfigValue>
 fn extract_all_configs(mut file: io::fs::File,
                        map: &mut HashMap<String, ConfigValue>) -> CargoResult<()> {
     let path = file.path().clone();
-    let contents = try!(file.read_to_str());
-    let file = path.filename_display().to_str();
+    let contents = try!(file.read_to_string());
+    let file = path.filename_display().to_string();
     let table = try!(cargo_toml::parse(contents.as_slice(),
                                        file.as_slice()).chain_error(|| {
         internal(format!("could not parse Toml manifest; path={}",
index 1f4d29be5cc57576302b64fe551efb9bb221db37..bb651207e8c3da56f74cfcc9f23ea5984cf76c32 100644 (file)
@@ -61,7 +61,7 @@ impl<T> DependencyQueue<T> {
     ///
     /// Only registered packages will be returned from dequeue().
     pub fn register(&mut self, pkg: &Package) {
-        self.reverse_dep_map.insert(pkg.get_name().to_str(), HashSet::new());
+        self.reverse_dep_map.insert(pkg.get_name().to_string(), HashSet::new());
     }
 
     /// Adds a new package to this dependency queue.
@@ -70,10 +70,10 @@ impl<T> DependencyQueue<T> {
     /// be added to the dependency queue.
     pub fn enqueue(&mut self, pkg: &Package, fresh: Freshness, data: T) {
         // ignore self-deps
-        if self.pkgs.contains_key(&pkg.get_name().to_str()) { return }
+        if self.pkgs.contains_key(&pkg.get_name().to_string()) { return }
 
         if fresh == Dirty {
-            self.dirty.insert(pkg.get_name().to_str());
+            self.dirty.insert(pkg.get_name().to_string());
         }
 
         let mut my_dependencies = HashSet::new();
@@ -84,12 +84,12 @@ impl<T> DependencyQueue<T> {
                 continue
             }
 
-            let name = dep.get_name().to_str();
+            let name = dep.get_name().to_string();
             assert!(my_dependencies.insert(name.clone()));
             let rev = self.reverse_dep_map.find_or_insert(name, HashSet::new());
-            assert!(rev.insert(pkg.get_name().to_str()));
+            assert!(rev.insert(pkg.get_name().to_string()));
         }
-        assert!(self.pkgs.insert(pkg.get_name().to_str(),
+        assert!(self.pkgs.insert(pkg.get_name().to_string(),
                                  (my_dependencies, data)));
     }
 
@@ -100,7 +100,7 @@ impl<T> DependencyQueue<T> {
     pub fn dequeue(&mut self) -> Option<(String, Freshness, T)> {
         let pkg = match self.pkgs.iter()
                                  .find(|&(_, &(ref deps, _))| deps.len() == 0)
-                                 .map(|(ref name, _)| name.to_str()) {
+                                 .map(|(ref name, _)| name.to_string()) {
             Some(pkg) => pkg,
             None => return None
         };
index 3d9953b04aaa5fe29622c284573e38facdad5fb8..902f8cd375fe9ef35f60476a2415bf64706fcf89 100644 (file)
@@ -120,20 +120,20 @@ impl<T, E: CargoError + Send> ChainError<T> for Result<T, E> {
 }
 
 impl CargoError for IoError {
-    fn description(&self) -> String { self.to_str() }
+    fn description(&self) -> String { self.to_string() }
 }
 
 from_error!(IoError)
 
 impl CargoError for TomlError {
-    fn description(&self) -> String { self.to_str() }
+    fn description(&self) -> String { self.to_string() }
 }
 
 from_error!(TomlError)
 
 impl CargoError for FormatError {
     fn description(&self) -> String {
-        "formatting failed".to_str()
+        "formatting failed".to_string()
     }
 }
 
@@ -152,8 +152,8 @@ from_error!(ProcessError)
 impl Show for ProcessError {
     fn fmt(&self, f: &mut Formatter) -> fmt::Result {
         let exit = match self.exit {
-            Some(ExitStatus(i)) | Some(ExitSignal(i)) => i.to_str(),
-            None => "never executed".to_str()
+            Some(ExitStatus(i)) | Some(ExitSignal(i)) => i.to_string(),
+            None => "never executed".to_string()
         };
         try!(write!(f, "{} (status={})", self.msg, exit));
         match self.output {
@@ -178,7 +178,7 @@ impl Show for ProcessError {
 }
 
 impl CargoError for ProcessError {
-    fn description(&self) -> String { self.to_str() }
+    fn description(&self) -> String { self.to_string() }
 
     fn detail(&self) -> Option<String> {
         self.detail.clone()
@@ -248,7 +248,7 @@ pub struct CliError {
 
 impl CargoError for CliError {
     fn description(&self) -> String {
-        self.error.to_str()
+        self.error.to_string()
     }
 }
 
@@ -256,7 +256,7 @@ from_error!(CliError)
 
 impl CliError {
     pub fn new<S: Str>(error: S, code: uint) -> CliError {
-        let error = human(error.as_slice().to_str());
+        let error = human(error.as_slice().to_string());
         CliError::from_boxed(error, code)
     }
 
@@ -276,7 +276,7 @@ pub fn process_error<S: Str>(msg: S,
                              status: Option<&ProcessExit>,
                              output: Option<&ProcessOutput>) -> ProcessError {
     ProcessError {
-        msg: msg.as_slice().to_str(),
+        msg: msg.as_slice().to_string(),
         exit: status.map(|o| o.clone()),
         output: output.map(|o| o.clone()),
         detail: None,
@@ -287,8 +287,8 @@ pub fn process_error<S: Str>(msg: S,
 pub fn internal_error<S1: Str, S2: Str>(error: S1,
                                         detail: S2) -> Box<CargoError + Send> {
     box ConcreteCargoError {
-        description: error.as_slice().to_str(),
-        detail: Some(detail.as_slice().to_str()),
+        description: error.as_slice().to_string(),
+        detail: Some(detail.as_slice().to_string()),
         cause: None,
         is_human: false
     } as Box<CargoError + Send>
@@ -296,7 +296,7 @@ pub fn internal_error<S1: Str, S2: Str>(error: S1,
 
 pub fn internal<S: Show>(error: S) -> Box<CargoError + Send> {
     box ConcreteCargoError {
-        description: error.to_str(),
+        description: error.to_string(),
         detail: None,
         cause: None,
         is_human: false
@@ -305,7 +305,7 @@ pub fn internal<S: Show>(error: S) -> Box<CargoError + Send> {
 
 pub fn human<S: Show>(error: S) -> Box<CargoError + Send> {
     box ConcreteCargoError {
-        description: error.to_str(),
+        description: error.to_string(),
         detail: None,
         cause: None,
         is_human: true
index 772109404d39c34d0c8aa5a109d3e92af0a1bcac..7b286e8929dae7d0317f68cc78bc226c9b0ccc73 100644 (file)
@@ -36,12 +36,12 @@ static PATH_SEP : &'static str = ";";
 
 impl ProcessBuilder {
     pub fn arg<T: Str>(mut self, arg: T) -> ProcessBuilder {
-        self.args.push(arg.as_slice().to_str());
+        self.args.push(arg.as_slice().to_string());
         self
     }
 
     pub fn args<T: Str>(mut self, arguments: &[T]) -> ProcessBuilder {
-        self.args = arguments.iter().map(|a| a.as_slice().to_str()).collect();
+        self.args = arguments.iter().map(|a| a.as_slice().to_string()).collect();
         self
     }
 
@@ -51,7 +51,7 @@ impl ProcessBuilder {
 
     pub fn extra_path(mut self, path: Path) -> ProcessBuilder {
         // For now, just convert to a string, but we should do something better
-        self.path.unshift(path.display().to_str());
+        self.path.unshift(path.display().to_string());
         self
     }
 
@@ -63,10 +63,10 @@ impl ProcessBuilder {
     pub fn env(mut self, key: &str, val: Option<&str>) -> ProcessBuilder {
         match val {
             Some(v) => {
-                self.env.insert(key.to_str(), v.to_str());
+                self.env.insert(key.to_string(), v.to_string());
             },
             None => {
-                self.env.remove(&key.to_str());
+                self.env.remove(&key.to_string());
             }
         }
 
@@ -139,7 +139,7 @@ impl ProcessBuilder {
         }
 
         match self.build_path() {
-            Some(path) => ret.push(("PATH".to_str(), path)),
+            Some(path) => ret.push(("PATH".to_string(), path)),
             _ => ()
         }
 
index 8e53918459881e57b9fd3314023e00f3c3e9a4df..854609c2fa8e05c25039ddf6e6f4acd79e57935e 100644 (file)
@@ -198,9 +198,9 @@ struct Context<'a> {
 fn inferred_lib_target(name: &str, layout: &Layout) -> Option<Vec<TomlTarget>> {
     layout.lib.as_ref().map(|lib| {
         vec![TomlTarget {
-            name: name.to_str(),
+            name: name.to_string(),
             crate_type: None,
-            path: Some(lib.display().to_str()),
+            path: Some(lib.display().to_string()),
             test: None
         }]
     })
@@ -209,16 +209,16 @@ fn inferred_lib_target(name: &str, layout: &Layout) -> Option<Vec<TomlTarget>> {
 fn inferred_bin_targets(name: &str, layout: &Layout) -> Option<Vec<TomlTarget>> {
     Some(layout.bins.iter().filter_map(|bin| {
         let name = if bin.as_str() == Some("src/main.rs") {
-            Some(name.to_str())
+            Some(name.to_string())
         } else {
-            bin.filestem_str().map(|f| f.to_str())
+            bin.filestem_str().map(|f| f.to_string())
         };
 
         name.map(|name| {
             TomlTarget {
                 name: name,
                 crate_type: None,
-                path: Some(bin.display().to_str()),
+                path: Some(bin.display().to_string()),
                 test: None
             }
         })
@@ -252,7 +252,7 @@ impl TomlManifest {
                     TomlTarget {
                         name: t.name.clone(),
                         crate_type: t.crate_type.clone(),
-                        path: layout.lib.as_ref().map(|p| p.display().to_str()),
+                        path: layout.lib.as_ref().map(|p| p.display().to_string()),
                         test: t.test
                     }
                 } else {
@@ -271,7 +271,7 @@ impl TomlManifest {
                     TomlTarget {
                         name: t.name.clone(),
                         crate_type: t.crate_type.clone(),
-                        path: bin.as_ref().map(|p| p.display().to_str()),
+                        path: bin.as_ref().map(|p| p.display().to_string()),
                         test: t.test
                     }
                 } else {
@@ -336,7 +336,7 @@ fn process_dependencies<'a>(cx: &mut Context<'a>, dev: bool,
                 let reference = details.branch.clone()
                     .or_else(|| details.tag.clone())
                     .or_else(|| details.rev.clone())
-                    .unwrap_or_else(|| "master".to_str());
+                    .unwrap_or_else(|| "master".to_string());
 
                 let new_source_id = match details.git {
                     Some(ref git) => {
index 72e643b6e6df28a32a7e50c96753d7f215e9aca7..90a3542ff912e2344360992381b21f754ae55d31 100644 (file)
@@ -30,7 +30,7 @@ struct FileBuilder {
 
 impl FileBuilder {
     pub fn new(path: Path, body: &str) -> FileBuilder {
-        FileBuilder { path: path, body: body.to_str() }
+        FileBuilder { path: path, body: body.to_string() }
     }
 
     fn mk(&self) -> Result<(), String> {
@@ -86,7 +86,7 @@ pub struct ProjectBuilder {
 impl ProjectBuilder {
     pub fn new(name: &str, root: Path) -> ProjectBuilder {
         ProjectBuilder {
-            name: name.to_str(),
+            name: name.to_string(),
             root: root,
             files: vec!(),
             symlinks: vec!()
@@ -108,7 +108,7 @@ impl ProjectBuilder {
     pub fn process<T: ToCStr>(&self, program: T) -> ProcessBuilder {
         process(program)
             .cwd(self.root())
-            .env("HOME", Some(paths::home().display().to_str().as_slice()))
+            .env("HOME", Some(paths::home().display().to_string().as_slice()))
             .extra_path(cargo_dir())
     }
 
@@ -195,7 +195,7 @@ pub fn main_file<T: Str>(println: T, deps: &[&str]) -> String {
     buf.push_str(println.as_slice());
     buf.push_str("); }\n");
 
-    buf.to_str()
+    buf.to_string()
 }
 
 trait ErrMsg<T> {
@@ -238,13 +238,13 @@ struct Execs {
 
 impl Execs {
 
-    pub fn with_stdout<S: ToStr>(mut ~self, expected: S) -> Box<Execs> {
-        self.expect_stdout = Some(expected.to_str());
+    pub fn with_stdout<S: ToString>(mut ~self, expected: S) -> Box<Execs> {
+        self.expect_stdout = Some(expected.to_string());
         self
     }
 
-    pub fn with_stderr<S: ToStr>(mut ~self, expected: S) -> Box<Execs> {
-        self.expect_stderr = Some(expected.to_str());
+    pub fn with_stderr<S: ToString>(mut ~self, expected: S) -> Box<Execs> {
+        self.expect_stderr = Some(expected.to_string());
         self
     }
 
@@ -310,7 +310,7 @@ impl Execs {
 
 impl ham::SelfDescribing for Execs {
     fn describe(&self) -> String {
-        "execs".to_str()
+        "execs".to_string()
     }
 }
 
@@ -354,13 +354,13 @@ impl<'a> ham::Matcher<&'a [u8]> for ShellWrites {
     {
         println!("{}", actual);
         let actual = std::str::from_utf8_lossy(actual);
-        let actual = actual.to_str();
+        let actual = actual.to_string();
         ham::expect(actual == self.expected, actual)
     }
 }
 
 pub fn shell_writes<T: Show>(string: T) -> Box<ShellWrites> {
-    box ShellWrites { expected: string.to_str() }
+    box ShellWrites { expected: string.to_string() }
 }
 
 pub trait ResultTest<T,E> {
@@ -397,7 +397,7 @@ impl<T> Tap for T {
 }
 
 pub fn escape_path(p: &Path) -> String {
-    p.display().to_str().as_slice().replace("\\", "\\\\")
+    p.display().to_string().as_slice().replace("\\", "\\\\")
 }
 
 pub fn basic_bin_manifest(name: &str) -> String {
index a46125d8b921634449ad03ecba0469724544ae72..54953514c898adab5b77709878c90c4fd2a3ba79 100644 (file)
@@ -153,7 +153,7 @@ test!(cargo_compile_with_warnings_in_a_dep_package {
         "#)
         .file("bar/src/bar.rs", r#"
             pub fn gimme() -> String {
-                "test passed".to_str()
+                "test passed".to_string()
             }
 
             fn dead() {}
@@ -230,7 +230,7 @@ test!(cargo_compile_with_nested_deps_inferred {
         "#)
         .file("baz/src/lib.rs", r#"
             pub fn gimme() -> String {
-                "test passed".to_str()
+                "test passed".to_string()
             }
         "#);
 
@@ -298,7 +298,7 @@ test!(cargo_compile_with_nested_deps_correct_bin {
         "#)
         .file("baz/src/lib.rs", r#"
             pub fn gimme() -> String {
-                "test passed".to_str()
+                "test passed".to_string()
             }
         "#);
 
@@ -374,7 +374,7 @@ test!(cargo_compile_with_nested_deps_shorthand {
         "#)
         .file("baz/src/baz.rs", r#"
             pub fn gimme() -> String {
-                "test passed".to_str()
+                "test passed".to_string()
             }
         "#);
 
@@ -450,7 +450,7 @@ test!(cargo_compile_with_nested_deps_longhand {
         "#)
         .file("baz/src/baz.rs", r#"
             pub fn gimme() -> String {
-                "test passed".to_str()
+                "test passed".to_string()
             }
         "#);
 
@@ -692,8 +692,8 @@ test!(custom_build_env_vars {
         .file("src/foo.rs", format!(r#"
             use std::os;
             fn main() {{
-                assert_eq!(os::getenv("OUT_DIR").unwrap(), "{}".to_str());
-                assert_eq!(os::getenv("DEPS_DIR").unwrap(), "{}".to_str());
+                assert_eq!(os::getenv("OUT_DIR").unwrap(), "{}".to_string());
+                assert_eq!(os::getenv("DEPS_DIR").unwrap(), "{}".to_string());
             }}
         "#,
         escape_path(&p.root().join("target")),
@@ -737,8 +737,8 @@ test!(custom_build_in_dependency {
         .file("src/foo.rs", format!(r#"
             use std::os;
             fn main() {{
-                assert_eq!(os::getenv("OUT_DIR").unwrap(), "{}".to_str());
-                assert_eq!(os::getenv("DEPS_DIR").unwrap(), "{}".to_str());
+                assert_eq!(os::getenv("OUT_DIR").unwrap(), "{}".to_string());
+                assert_eq!(os::getenv("DEPS_DIR").unwrap(), "{}".to_string());
             }}
         "#,
         escape_path(&p.root().join("target/deps")),
@@ -808,7 +808,7 @@ test!(many_crate_types_old_style_lib_location {
         match f.filename_str().unwrap() {
             "deps" => None,
             s if s.contains("fingerprint") || s.contains("dSYM") => None,
-            s => Some(s.to_str())
+            s => Some(s.to_string())
         }
     }).collect();
     files.sort();
@@ -846,7 +846,7 @@ test!(many_crate_types_correct {
         match f.filename_str().unwrap() {
             "deps" => None,
             s if s.contains("fingerprint") || s.contains("dSYM") => None,
-            s => Some(s.to_str())
+            s => Some(s.to_string())
         }
     }).collect();
     files.sort();
index 42a25f10c4c9288534d5f8c57ff44199320bf467..3c6fa7c0d4e7e27e59b2388b8a5b89135921c29f 100644 (file)
@@ -66,7 +66,7 @@ test!(cargo_compile_with_nested_deps_shorthand {
         "#)
         .file("bar/baz/src/baz.rs", r#"
             pub fn gimme() -> String {
-                "test passed".to_str()
+                "test passed".to_string()
             }
         "#);
 
index aa6d6bb07ce7b640e84124f81dcfa9afc0e238a6..e7dc72eb7b59e6686bfa4490fb2d32022bc2416b 100644 (file)
@@ -56,5 +56,5 @@ fn colored_output<S: Str>(string: S, color: color::Color) -> IoResult<String> {
     try!(term.write_str(string.as_slice()));
     try!(term.reset());
     try!(term.flush());
-    Ok(from_utf8_lossy(term.get_ref().get_ref()).to_str())
+    Ok(from_utf8_lossy(term.get_ref().get_ref()).to_string())
 }